#ifndef CONTAINER_H
#define CONTAINER_H

#include "Obstacle.h"
#include "Singleton.h"
#include <AntTweakBar.h>
#include <glm/glm.hpp>

class Container : public Singleton<Container>, Obstacle{
private:
	static float MIN_SIZE;
	static float MAX_SIZE;

	float width;
	float height;
	float depth;

	bool drawMode;
	float minDist;
public:

	Container();
	Container(float x, float y, float z, bool b = true, float minDist = 40);

	void setWidth(float f){ width = f/2.f; }
	void setHeight(float f){ height = f/2.f; }
	void setDepth(float f){ depth = f/2.f; }

	float getWidth(){ return width*2; }
	float getHeight(){ return height*2; }
	float getDepth(){ return depth*2; }

	void changeDrawMode();

	glm::vec3 getNormal(glm::vec3 position);

	virtual void draw();
	virtual void collide();

	void setMinDist(float f){ minDist = f; }
	float getMinDist(){ return minDist; }

	static void TW_CALL changeDrawModeCallback(void* clientData){
		Container::get_Instance()->changeDrawMode();
	}

	static void TW_CALL setWidthCallback(const void *value, void *clientData){
		Container::get_Instance()->setWidth(*static_cast<const float *>(value));
	}
	static void TW_CALL setHeightCallback(const void *value, void *clientData){
		Container::get_Instance()->setHeight(*static_cast<const float *>(value));
	}
	static void TW_CALL setDepthCallback(const void *value, void *clientData){
		Container::get_Instance()->setDepth(*static_cast<const float *>(value));
	}

	static void TW_CALL getWidthCallback(void *value, void *clientData){
		*static_cast<float *>(value) = Container::get_Instance()->getWidth();
	}
	static void TW_CALL getHeightCallback(void *value, void *clientData){
		*static_cast<float *>(value) = Container::get_Instance()->getHeight();
	}
	static void TW_CALL getDepthCallback(void *value, void *clientData){
		*static_cast<float *>(value) = Container::get_Instance()->getDepth();
	}

	static void TW_CALL setMinDistCallback(const void *value, void *clientData){
		Container::get_Instance()->setMinDist(*static_cast<const float *>(value));
	}
	static void TW_CALL getMinDistCallback(void *value, void *clientData){
		*static_cast<float *>(value) = Container::get_Instance()->getMinDist();
	}

};


#endif